package com.flow.demo.module.gd.dal.mysql.good;


import com.flow.demo.framework.common.pojo.PageResult;
import com.flow.demo.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.flow.demo.framework.mybatis.core.mapper.BaseMapperX;
import com.flow.demo.module.gd.controller.app.good.vo.GoodPageReqVO;
import com.flow.demo.module.gd.dal.dataobject.good.GoodDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 奖品 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface GoodMapper extends BaseMapperX<GoodDO> {

    default PageResult<GoodDO> selectPage(GoodPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<GoodDO>()
                .likeIfPresent(GoodDO::getPrizeName, reqVO.getPrizeName())
                .eqIfPresent(GoodDO::getPrizeStock, reqVO.getPrizeStock())
                .eqIfPresent(GoodDO::getPrizeWeight, reqVO.getPrizeWeight())
                .eqIfPresent(GoodDO::getPrizeImage, reqVO.getPrizeImage())
                .betweenIfPresent(GoodDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(GoodDO::getPrizeId));
    }

}
